﻿using System.Text;
namespace QzEbook.Common
{
    public class SqlStringBuilder
    {
        private StringBuilder sb;
        private bool hasHeader = false;

        public SqlStringBuilder()
        {
            sb=new StringBuilder();
        }
        public void appendHead(string plus)
        {
        }

        public void appendAnd(string plus)
        {
            if (plus == string.Empty) return;
            if (hasHeader)
            {
                sb.AppendFormat(" and {0}", plus);
                return;
            }
            sb.AppendFormat("{0}", plus);
            hasHeader = true;
        }
        public void appendOr(string plus)
        {
            if (plus == string.Empty) return;
            sb.AppendFormat("or {0}", plus);
        }

        public override string ToString()
        {
            return sb.ToString();
        }
    }
}